<%@ page language="java" contentType="application/vnd.ms-excel; charset=UTF-8"%>
<%@ page import="com.b2c.ftysys.sevice.*,java.util.*,com.b2c.ftysys.domain.*,org.springframework.web.context.*"%>

<%
response.setCharacterEncoding("UTF-8");
Calendar now = Calendar.getInstance();
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Content-disposition","attachment;filename="+now.get(Calendar.DATE)+now.get(Calendar.MILLISECOND)+".xls");   

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";


String[] skus = (String[])request.getParameterValues("skus");
List<Pdtorder> dataList = new ArrayList<Pdtorder>();


if(skus!=null){
	
	WebApplicationContext wac = (WebApplicationContext)config.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); 
	OrderReviewService service = (OrderReviewService)wac.getBean("OrderReviewService");
    dataList = service.getOrderItemList(skus);
}
int ordernum=0;
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>orderOutPut</title>
  </head>
  
  <body>
    <table cellspacing="0" cellpadding="0" width="100%" border="1" bordercolor="#000000">
  <col width="54" />
  <col width="94" />
  <col width="97" />
  <col width="494" />
  <col width="32" />
  <col width="75" />
  <col width="64" />
  <col width="65" />
  <tr height="19">
    <td colspan="8" height="19" width="975"><a name="RANGE!A1:H10" id="RANGE!A1:H10">(<%=now.get(Calendar.YEAR)%>年<%=(now.get(Calendar.MONTH)+1)%>月<%=now.get(Calendar.DATE)%>日）供应商送货单</a></td>
  </tr>
  <tr height="19">
    <td colspan="8" height="19">供货商编号: 0273</td>
  </tr>
  <tr height="19">
    <td colspan="8" height="19">供货商名称(卖方): 韩琪光</td>
  </tr>
  <tr height="19">
    <td colspan="8" height="19">采购日期： </td>
  </tr>
  <tr height="19">
    <td height="19">采购单号</td>
    <td>条码</td>
    <td>SKU</td>
    <td width="494">产品属性</td>
    <td>数量</td>
    <td>到货日期</td>
    <td>发货日期</td>
    <td>采购备注</td>
  </tr>
  <%for(Pdtorder pdtOrder:dataList){
	  ordernum+=pdtOrder.getOrdernum();
  %>
  <tr height="19">
    <td height="19"><%=pdtOrder.getOrderid()%></td>
    <td>&nbsp <%=pdtOrder.getCmtpdtid()%></td>
    <td><%=pdtOrder.getCmtpdtorderid()%></td>
    <td width="494"><%=pdtOrder.getAttribute()%></td>
    <td><%=pdtOrder.getOrdernum()%></td>
    <td><%=pdtOrder.getArrivedate()%></td>
    <td><%=now.get(Calendar.YEAR)%>-<%=(now.get(Calendar.MONTH)+1)%>-<%=now.get(Calendar.DATE)%></td>
    <td>正常发货</td>
  </tr>
 <%}%>
   <tr height="19">
    <td height="19">　</td>
    <td>　</td>
    <td>　</td>
    <td width="494">　</td>
    <td><%=ordernum%></td>
    <td>　</td>
    <td>　</td>
    <td>　</td>
  </tr>
</table>
  </body>
</html>
